import { getOneStringDes } from '../../utils/sysMakeString'

const getters = {
  loadingCtrl: state => state.loadingCtrl,
  // 标签聚合详情数据
  groupPicData: state => state.groupPicData,
  // 详情页处理后数据
  handleData: state => state.handleData,
  // 聚合类别
  groupCategory: state => state.groupCategory,
  // 筛选条件类别(可修改)
  filterData: state => state.filterData,
  // 省市区（县）级联列表
  location: state => state.location,
  // 筛选条件 对话框 穿梭框左侧数据
  transferLeft: state => state.transferLeft,
  // 筛选条件类别副本(原生数据)
  filterDataCopy: state => state.filterDataCopy,
  // 筛选条件
  filterCategory: state => state.filterCategory,
  tableData: state => {
    // 添加“描述” & “标题”
    for (let idx in state.tableData) {
      let el = state.tableData[idx]
      // 主table 日志描述
      el._source.describes = getOneStringDes(el._source)
      // 详情页描述
      el._source.summary = getOneStringDes(el._source, 'summary')
    }
    return state.tableData
  },
  // 分页信息
  pagination: state => state.pagination,
  // 历史搜索数据
  history: state => state.history,
  // 上一次点开的监测日志类别
  lastLogType: state => state.lastLogType,
  // 大的日志类别
  logType: state => state.logType,
  // 筛选条件 日志类型
  stypeDict: state => state.stypeDict
}

export default getters
